package com.lw.entity.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;


/**
 *  表定义层。
 *
 * @author lw
 * @since 2025年04月29日 11:35:15
 */
public class TbInterfaceTableDef extends TableDef {

    private static final long serialVersionUID = 1L;

    /**
     * 
     */
    public static final TbInterfaceTableDef TB_INTERFACE = new TbInterfaceTableDef();

    
    public final QueryColumn ID = new QueryColumn(this, "id");

    /**
     * 编号
     */
    public final QueryColumn CODE = new QueryColumn(this, "code");

    /**
     * 名称
     */
    public final QueryColumn NAME = new QueryColumn(this, "name");

    /**
     * 端口
     */
    public final QueryColumn PORT = new QueryColumn(this, "port");

    /**
     * 类型
     */
    public final QueryColumn TYPE = new QueryColumn(this, "type");

    /**
     * 状态
     */
    public final QueryColumn STATUS = new QueryColumn(this, "status");

    /**
     * 地址
     */
    public final QueryColumn ADDRESS = new QueryColumn(this, "address");

    /**
     * 用户服务数量
     */
    public final QueryColumn USER_COUNT = new QueryColumn(this, "user_count");

    
    public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");

    
    public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");

    /**
     * 服务次数
     */
    public final QueryColumn SERVICE_COUNT = new QueryColumn(this, "service_count");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, NAME, CODE, TYPE, ADDRESS, PORT, USER_COUNT, SERVICE_COUNT, STATUS, CREATE_TIME, UPDATE_TIME};

    public TbInterfaceTableDef() {
        super("", "tb_interface");
    }

    private TbInterfaceTableDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public TbInterfaceTableDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new TbInterfaceTableDef("", "tb_interface", alias));
    }

}
